I did this on my audi a4 b7 earlier
Step1 press the unlock button on your key fob
Step 2 put key in ignition and turn to position 2 (Position 1 off Postion 2 on postion 3 start do not start the car)
Step 3 turn back off and remove key
Step 4 press the lock then unlock button.
Worked for me and got this out of the hand book