title: Convert a column values to column names SQL server
body: <p>I have a table with below schema. Would like to get results as in expected result in SQL server. Pivot does not work as Value column is string. Please suggest efficient way to achieve this. Thanks!  </p>
  
  <p>Table:</p>
  
  <pre><code> Dim Key(String) , Dim Value (String)
     AB                XY1 
     AB                XY2
     CD                XY3
     CD                XY4
  </code></pre>
  
  <p>Expected Result</p>
  
  <pre><code>New columns=&gt;  AB      CD
  Row values =&gt;  XY1     XY3
                 XY2     XY4
  </code></pre>