Detecting service pack?

How can I programmatically detect which service pack has been installed on the client machine

Answer this question

Detecting service pack?