Many, many people have complained about having difficulty installing SQL 2005 SP2.  I got it half installed (it failed on certain services and it failed entirely with the first security update after SQL SP2.

I tried a bunch of things including registry changes, deleting entries in log files and directories, but I got it successfully installed by resetting the performance counters in SQL.

Here are the steps:

1) Download and install SQL 2005 SP2.

2) Manually download and install the Security Update for SQL Server 2005 SP2 – http://www.microsoft.com/downloads/details.aspx?familyid=4C9851CC-2C4C-4190-872C-84993A7623B7&displaylang=en

3) Record the error message that you see when it fails.  In my case I got error code 29528 which refers to PerfMon Counters being out of sync.

4) Manually stop all SQL Services.

5) Reset PerfMon counters by issuing the following command from a command prompt:

cd c:windowssystem32lodctr /R

6) Reboot your server and make sure that all SQL Services have restarted.