There are a couple of solutions to this:
If using IIS7
It comes with a .net api Microsoft.Web.Administration.dll
This can be reference directly or loaded at runtime it allows you to get a sites bindings and see if a certificate is attached, remove a certificate or add one to a binding.
If you need something to work with both iis7 and iis6 then you need to us httpapi.dll which is a win32 dll so from .net requires some pinvoke work
This link proved invaluable
http://www.pinvoke.net/default.aspx/httpapi.httpqueryserviceconfiguration[
^]