title: How to take values from a column and assign them to other columns
body: <p>Here's what I have:</p>
  <pre><code>DECLARE @keyString2 nvarchar(500)
  SET @keyString2 = 
      (SELECT TOP (1) Key_analysis 
      FROM  testing.dbo.[nameWIthoutSpecialChars])
  IF CHARINDEX('Limit of Insurance Relativity Factors' , @keyString2) &gt; 0
     EXEC sp_rename 'testing.dbo.nameWIthoutSpecialChars.Key2', 
                    'Limit of Insurance Relativity Factors', 
                    'COLUMN';
  </code></pre>
  <p>Basically what I'm doing with that code is renaming column names
  with values that are from a different column. Though, if you see, there's a hardcoded string in CHARINDEX, I'd have to already know what's inside of that variable which makes it a real manual process. I could essentially just hardcode the EXEC and run it over and over without even needing the IF statement.</p>
  <p>What I'm trying to accomplish is to rename columns based off of values inside of another.</p>
  <p>To make it more clear I have a table like this:</p>
  <pre><code>+--------------------------------+---------+---------+
  | Description                    | Column2 | Column3 |
  +--------------------------------+---------+---------+
  | string value 1, string value2  |         |         |
  +--------------------------------+---------+---------+
  | string value 1, string value2  |         |         |
  +--------------------------------+---------+---------+
  | string value 1, string value 2 |         |         |
  +--------------------------------+---------+---------+
  </code></pre>
  <p>The values in the &quot;Description&quot; column will be the same throughout the table. What I want to have happen is that those values replace the other columns like so</p>
  <pre><code>+--------------------------------+----------------+----------------+
  | Description                    | string value 1 | string value 2 |
  +--------------------------------+----------------+----------------+
  | string value 1, string value2  |                |                |
  +--------------------------------+----------------+----------------+
  | string value 1, string value2  |                |                |
  +--------------------------------+----------------+----------------+
  | string value 1, string value 2 |                |                |
  +--------------------------------+----------------+----------------+
  </code></pre>
  <p>The only other caveat here is that there may be more or less string values than the 2 shown, I want to run this through multiple tables. Every table has 10 columns that are just like &quot;Column1&quot; and &quot;Column2&quot; in the example, meaning 10 potential columns that need to be renamed considering how many values are in the &quot;Description&quot; column</p>