title: T:SQL: select values from rows as columns
body: <p>I have a table for Profiles stores profile properties values in row style, ex:</p>
  
  <pre><code>[ProfileID]     [PropertyDefinitionID]      [PropertyValue]
  1               6                           Jone
  1               7                           Smith
  1               8                           Mr
  1               3                           50000
  </code></pre>
  
  <p>and another table for property definitions :</p>
  
  <pre><code>[PropertyDefinitionID]  [PropertyName]
  6                       FirstName
  7                       LastName
  8                       Prefix
  3                       Salary
  </code></pre>
  
  <p>How to use <code>PIVOT</code> or any other way to show it in this way:</p>
  
  <pre><code>[ProfileID] [FirstName] [LastName]  [Salary]
  1           Jone        Smith       5000
  </code></pre>