title: Efficiently convert rows to columns in sql server
body: <p>I'm looking for an efficient way to convert rows to columns in SQL server, I heard that PIVOT is not very fast, and I need to deal with lot of records.</p>
  
  <p>This is my example:</p>
  
  <pre><code>   -------------------------------
     | Id | Value  | ColumnName    |
     -------------------------------
     | 1  | John   | FirstName     |
     | 2  | 2.4    | Amount        |
     | 3  | ZH1E4A | PostalCode    |
     | 4  | Fork   | LastName      |
     | 5  | 857685 | AccountNumber |
     -------------------------------
  </code></pre>
  
  <p>This is my result:</p>
  
  <pre><code>---------------------------------------------------------------------
  | FirstName  |Amount|   PostalCode   |   LastName  |  AccountNumber |
  ---------------------------------------------------------------------
  | John       | 2.4  |   ZH1E4A       |   Fork      |  857685        |
  ---------------------------------------------------------------------
  </code></pre>
  
  <p>How can I build the result?</p>