title: Help needed with Dynamic Pivoting in SQL2005
body: <p>I have a table of name value pairs where I am storing tags:</p>
  
  <pre><code>TAGID | NAME | VALUE
  </code></pre>
  
  <p>I have a table of 'Things' this tags apply to</p>
  
  <pre><code>THINGID | TAGID
  </code></pre>
  
  <p>I need a query to generate a resultSet were the columns/fields are all possible TAG-NAMES (NAME field in the TAG table)for a given THINGID and the values are the correspondent tag values.</p>
  
  <pre><code>THINGID | TAGNAME1 | TAGNAME2 | ... |etc.
  </code></pre>
  
  <p>I can find examples with fixed columns but nothing like this.</p>