Unplug the headlight switch connector. If the headlights go out, the switch is faulty. If they stay on, unplug the Body Control Module (BCM). If they now go out it is a bad BCM.
The Body Control Module (BCM) sends out voltage to the headlight switch. If the voltage is grounded, the BCM grounds the headlight on relay. The headlight switch should not pull the voltage down at all, unless it is switched to the on position.
Diagram below shows the PLUG for the BCM and the BCM's general location