title: Select Data with Column's Description not null, and then replace column name with description
body: <p>I have a table 'PurchaseOrder'. I want select data when column's description is not null. and then replace the column's name with it's description. </p>
  
  <p>table PurchaseOrder</p>
  
  <pre><code>ID | Product    |  Use    |   Price   |  Comment 
  -----------------------------------------------------
  1  | Cellphone  |  true   |   100     |   
  2  | Car        |  false  |   10      |   
  3  | Table      |  true   |   200     |   
  </code></pre>
  
  <p>Column </p>
  
  <pre><code>Name      |    Description
  ---------------------------
  ID        |    Index
  Produce   |    Name
  Use       |    
  Price     |    Sale
  Comment   |
  </code></pre>
  
  <p>The Select result will be</p>
  
  <pre><code>Index  |   Name      |    Sale
  --------------------------------
  1      |   Cellphone |    100        
  2      |   Car       |    10         
  3      |   Table     |    200    
  </code></pre>
  
  <p>Now, I just get the column with description</p>
  
  <pre><code>if object_id('tempdb..#dt') is not null drop table #dt
  select 
      sc.column_id [Position],
      sc.name [Column],
      sc.max_length [Length],
      sep.value [Description]
  into #dt
  from sys.tables st
  inner join sys.columns sc on st.object_id = sc.object_id
  left join sys.extended_properties sep on st.object_id = sep.major_id
                                       and sc.column_id = sep.minor_id
                                       and sep.name = 'MS_Description'
  where st.name = 'PurchaseOrder' and sep.value is not null 
  </code></pre>
  
  <p>How to generate the final data table?</p>