title: create a table using distinct values from a column as the column names in a code
body: <p>I have a table like below figure with some distinct values. I'd like to create a new table with a column for each distinct value in R column, the column name would be started with S. Thanks in advance for your help. (in sql server or in c# or vb.net)</p>
  
  <p>My Table:</p>
  
  <pre>
  Name Family R   C  D
  ---------------------
  N1   F1     S1  1  A
  N2   F2     S2  2  A
  N3   F3     S1  1  B
  N4   F4     S2  2  B
  N5   F5     S3  3  A
  </pre>
  
  <p>New Table:</p>
  
  <pre>
      S1  S2  S3 .......
  ---------------------------------
  A   N1  N2  N5 .......
      F1  F2  F5 .......
  ----------------------------------
  B   N3  N4
      F3  F4
  </pre>