title: Using single quote in an Exec statement in SQL
body: <p>I am having issues executing a SQL statement from a stored proc having single quotes. Here is my query from a stored procedure that I am executing.</p>
  
  <pre><code>EXEC('UPDATE myTABLE 
           SET myCOLUMN = (SELECT Replace('OSINGLEQUOTEJOHN DOE','SINGLEQUOTE','''')')
  </code></pre>
  
  <p>I am trying to update table "myTABLE" column "myCOLUMN" with a value "O'John Doe"</p>
  
  <p>The actual query is like this, i tried to simplify it a bit in the above example</p>
  
  <pre><code>EXEC('UPDATE myTABLE 
           SET myCOLUMN = (SELECT Replace('+ @IntegrationGuardian2FullName +','SINGLEQUOTE','''')')
  </code></pre>
  
  <p>The value of <code>@IntegrationGuardian2FullName</code> is "OSINGLEQUOTEJOHN DOE". Hope that makes more sense.</p>
  
  <p>Can any body help me formatting this query?</p>