title: How to execute a stored procedure which has its object name stored in a variable
body: <p>I have a table which contains a column of stored procedures associated with each tuple. I have an <code>Execute SQL Task</code> which selects the procedure for the desired tuple and stores it in a variable. I then connect that to another <code>Execute SQL Task</code> which uses the statement <code>EXEC ?</code> and map the variable as a parameter. It fails to execute though, showing an error:</p>
  
  <blockquote>
    <p>The type for parameter '@P1' cannot be deduced in this context</p>
  </blockquote>
  
  <p>This is how the variable looks:</p>
  
  <pre><code>@[User::ProcedureName] = "dbo.TestProcedure"
  </code></pre>
  
  <p>The <code>Execute SQL Task</code> for getting procedure name</p>
  
  <pre><code>SELECT ProcedureName FROM Table WHERE ProcedureID = 1
  </code></pre>
  
  <p>Results into @[User::ProcedureName]</p>
  
  <p>The <code>Execute SQL Task</code> for executing procedure</p>
  
  <pre><code>EXEC ?
  </code></pre>
  
  <p>With @[User::ProcedureName] as a parameter</p>
  
  <p>Is there a way to do this?</p>