I've done a lot of research on this particular problem and I think they fall into two groups, software and hardware.
Many of the forums out there say the problem occurred after yanking out a set of headphones and may be fixed by poking a toothpick in the headphone socket or wiggling the headphone jack. Many posts say this worked but did not work for me.
My problem started when I inherited a MacBook Pro 17" laptop with OS 10.5.6 installed on it, but the machine had no built in sound and the only driver showing in the sound preference pane was the digital output driver. I upgraded to OS 10.6, then OS 10.6.1 and the problem continued. I then wiped the disk and installed OS 10.5.1 and did a combo updater to 10.5.8, then installed OS 10.6. The problem was still there.
I then wiped the drive clean and installed OS 10.5.1 (without doing any updates) and immediately upgraded to OS 10.6.
Voila! My sound is back without any problems and the sound preference panel shows the built-in sound driver (without any digital out driver).
My belief is that if you have the software issue, then it depends on how you go about doing the updates or upgrade in Leopard and/or Snow Leopard.
Anyone else have any ideas?