title: How to execute stored procedure with sql query results in TSQL?
body: <p>Assuming I have table with tasks called <code>Tasks</code>.</p>
  
  <p>I want to delete selected tasks with stored procedure <code>SP_Task_DEL</code> (which deletes tasks).</p>
  
  <p>This procedure have one parameter <code>@Id</code> (id of task to delete).</p>
  
  <p>How to execute this stored procedure many times with all results of query:</p>
  
  <pre><code>select id from Tasks where status = 'completed'
  </code></pre>
  
  <p>?</p>