I believe I may be able to help you. Before we get into a wiring problem (which can get complicated) let's rule out a bad switch. Try disconnecting the headlamp switch. Turn the switch to the "off" position and then push it in. With the switch pushed in, turn it clockwise until it stops, it should stop around the "auto" position. Once it stops, pull switch out. Once the switch is out you can disconnect the connector. If the lights go out with the switch disconnected you probably have a bad switch. If they remain on, you more than likely have a wiring problem.
Wrong coding is a possibility, but theoretically the coding will not change by itself. So, as long as nobody as gone into the system and changed anything that shouldn't be the issue. Now that I have the VIN I can get more specific information on everything including the wiring diagrams. According to the information I have, your car has the HID gas discharge headlamp system. This changes things a little bit.
I believe the switch may actually be your problem, and here's why; when the headlamps turn on and stay on it typically means they have gone into a "default mode". Default mode is a safety feature that will automatically turn the headlights on if a fault is detected within the system. If there is a fault in the switch, the control module will turn the headlamps on to prevent you from having to drive around at night with no headlights. If you unplug the headlamp switch, the control module detects that as an open circuit fault and the control module will turn the headlamps on. At this point I would recommend replacing the switch. If the switch does not solve the problem I may need fault codes form the headlamp control module. Any repair facility with a VAS tester, VAG COM, or Ross Tech software should be able to retrieve any faults from the system.
From 1996 onward all OBD2 connectors are the same. On the other hand, the programming can differ. With most typical scanner you can only get engine codes or "P" codes. To scan all other control modules in an Audi you need special progams. VAS testers are the testers provided by VW and Audi, VAG COM and Ross Tech and independant programs that will communicate with control modules apart from the engine and transmission module. VAG COM is more widely used than Ross Tech, but it's rather expensive. I've used VAG COM before, but not Ross Tech. The VAG COM software will do most of the things that can be done with the VAS testers. However, there are still some things that can only be done through a VAS tester, but for what you need VAG COM should work fine.
As far as a cheaper aftermarket part goes, I wouldn't recommend it. There are some manufacturers that I wouldn't recommend putting aftermarket parts on, and Audi is one of them. Aftermarket parts don't always use the same specifications that the manufacturer does, therefore they don't always function just right or they don't fit into place as well as the original equipment does.