I had this same problem over a long period of time. My dealer repeatedly reprogrammed the keys but after a period of time, sometimes days, sometimes months, the remote would always fail again.
I bought a new remote control unit from a car being broken, fitted it myself (a right pain as you have to take out the rear seats and parcel shelf) and had the keys reprogrammed at the next service. Since then absolutely perfect!