title: Easy way to convert exec sp_executesql to a normal query?
body: <p>When dealing with debugging queries using Profiler and SSMS, its pretty common for me to copy a query from Profiler and test them in SSMS.  Because I use parameterized sql, my queries are all sent as exec sp_executesql queries.  </p>
  
  <pre><code>exec sp_executesql 
  N'/*some query here*/', 
  N'@someParameter tinyint',
  @ someParameter =2
  </code></pre>
  
  <p>I'll take this and convert it into a normal query for ease of editing (intellisense, error checking, line numbers, etc):</p>
  
  <pre><code>DECLARE @someParameter tinyint
  SET @someParameter = 2
  
  /*some query here*/
  </code></pre>
  
  <p>Of course, the bigger and more complex the query, the harder to do this.  And when you're going back and forth multiple times, it can be a pain in the ass and soak up lots of time.</p>
  
  <p>Is there an easy (e.g., macro command) way to convert muh executesql into something more convenient?</p>