In Spain this is possible. It is called “testamento vital” or “documento de voluntades anticipadas”, and the goal is just that: to declare, in a legally binding way, your wish to receive or not receive certain kinds of medical treatments in the future, in case you can no longer decide when the time comes. This includes euthanasia in cases where it is legally allowed. Alzheimer is one of such cases.