title: Execute multiple stored procedures based on the parameter in SQL Server
body: <p>I'm trying to execute multiple stored procedures based on parameter. I have one stored procedure where it calls 5 stored procedures. Each stored procedure returns different result sets.</p>
  
  <p>As a parameter I'm passing <code>'Notes,Viewers,Editors,..etc'</code>. Based on this list I need to execute and get all the results and return it.</p>
  
  <p>Currently what I'm trying is follows;</p>
  
  <ul>
  <li>Insert the parameter into a temp table as table rows.</li>
  <li>Using a cursor iterate through the table rows and execute the stored procedures.</li>
  <li><p>Inside the cursor I'm checking </p>
  
  <pre><code> if @row = 'Editor' EXEC sp 1
   else if @row = 'Viewers' EXEC sp 2
   ...
   ...
  </code></pre></li>
  </ul>
  
  <p>At the end of this iteration I need to return all the results. </p>
  
  <p>So my question is, Is this the best way to get it done OR are there any good solutions to cater these kind of operations.</p>