title: change column names in a dynamic pivot table result
body: <p>I have a tsql dynamic pivot table query that works fine although I´m not happy with the column names in the final output.</p>
  
  <p>To make it work, the user has to select up to 20 fruit names from a list of 200 fruit names. Then I build the pivot table so I end up with different column names everytime the select is run.
  For example:
  First time the column names are: apple, orange and pear
  Second time is: .orange, banana,  kiwi and apple</p>
  
  <p>My question is: Is there a posibility to have static names, like for example: name of the first column always "col_1", second column "col_2" etc?</p>
  
  <p>The select statement is as follows: </p>
  
  <pre><code>DECLARE @idList varchar(800) 
  DECLARE @sql nvarchar(max)
  
  SELECT @idList = coalesce(@idList + ', ', '') + '['+ltrim(rtrim(id_producto)) +']'
  from gestor_val_pos
  group by id_producto order by id_producto
  
  SELECT @sql = 'select * from #correlaciones pivot (max (correl) 
  for codigo2   in (' + @IDlist + ')) AS pvt order by codigo1;'
  
  exec sp_executeSQL @sql
  </code></pre>