title: SQL Server 2008 Try/Catch parameter names and values
body: <p>I have searched, but was not able to find how to get the parameters names and values of a stored procedure from the catch section of a try/catch in SQL server 2008.</p>
  
  <p>I know how to get the parameters for example:</p>
  
  <pre><code>SELECT  parm.name AS Parameter
          ,typ.name AS [Type]
  FROM    sys.procedures sp
          JOIN sys.parameters parm ON sp.object_id = parm.object_id
          JOIN sys.types typ ON parm.system_type_id = typ.system_type_id
  WHERE   sp.name = OBJECT_NAME(@@procid)
  </code></pre>
  
  <p>Basically what I am looking for is the SP that executed with parameters and values so I can log and troubleshoot.  Something like:</p>
  
  <pre><code>wsp_GetUser_s @UserID = 123, @UserName = 'juser'
  </code></pre>