title: Dynamically pass xml to a stored procedure
body: <p>I have a temp table that has 2 columns.</p>
  
  <pre><code>CREATE TABLE #ExecuteThese
      (
          StoredProcedure nvarchar(200),
          Parameter xml
      )
  </code></pre>
  
  <p>What I am trying to do is in a cursor execute all the stored procedures in this temp table and pass the xml parameter to it, while also catching the return value of the procedure.</p>
  
  <p>Am I on the right track? <code>@parameters</code> and <code>@storedProc</code> are cursor variables</p>
  
  <pre><code>-- Capture the return level code
  DECLARE @returnLevel int
  exec sp_executesql @storedProc, N'@parameters xml', @parameters, N'@returnLevel int output', @returnLevel output
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>thanks!</p>