Hi.
If the service 4WD light is on, then there is an issue with transmission or with 4WD module or switch. The truck must go to the dealer to do a code scanning. A general OBDII scanning like that done for free at Autozone will only pull down codes from main computer, not from Transfer Case Control Module (TCCM).That will not help. A code scanning at the dealer costs about $80.
A common fault that result in sudden 4WD failure and Service 4WD light turning on is a defective encoder sensor. The sensor is located in the shifter at one side of transfer case. If problem is the sensor you may get a code C0327. The sensor is tested reading voltage out. If sensor is working there will be a very little shift in voltages when you switch from 2WD to 4WD. The votage change is very little, and the sensor is difficult to test. See:
.GMC Sierra Encoder Sensor ReplacementOther common fault is a defective 4WD switch. This can be tested using a multimeter.Sometimes it results in code B2725. Sometimes it is easier to replace the switch straight away if the code is present. There was a service bulletin reporting the switch problem on 2002-2003 trucks. If code B2725 is shown replace the switch.
There are more faults that can results in the same symptoms, but the two problems listed above are the most common. Problems such as a faulty TCCM do not occur very often.
Do a code scanning and check the two faults listed in my comments.