Microsoft has several different versions of SQL and occasionally an install fails or an upgrade fails and normal uninstallation is impossible. MS recommends that you use regedit to delete all the relevant keys. Unfortunately, this doesn’t always work, as some keys (for instance, SQL$) refuse to delete and indicate they are devices?even in safe mode.
Here’s how to fix the problem: from your control panel, go to Hardware, select Hidden Devices and SQL will be listed as a device and greyed out. Delete those devices, reboot, and SQL will then re-install itself.
This method removes the SQL$ registry keys that refuse to delete normally using regedit; if you don’t delete them, SQL will not re-install.