title: How to get SQL Server process ID with C#
body: <p>On my Windows Server 2008 I have local instance of SQL Server 2008 (or later 2012.) The server also has IIS configured to run ASP.NET web applications that connect to that SQL server to do basic SELECT, INSERT, UPDATE, DELETE operations. </p>
  
  <p>I also have a Windows service application that I wrote in C# that runs on the same server. I want to add a function to it that checks CPU usage on the SQL Server process. I can do so knowing its PID.</p>
  
  <p>My question is, how to get the process ID of the SQL Server process?</p>