title: Selecting values from another table based on columns stored as value on the table
body: <p>Table 1st :</p>
  
  <pre><code>---------------------------------------
      Column_A                Column_B
  ---------------------------------------
      Test A                  name
      Test B                  address
      Test C                  phone
  </code></pre>
  
  <p>Table 2nd :</p>
  
  <pre><code>-------------------------------------------------------------------
      name        address         email       country         phone           
  -------------------------------------------------------------------
      Kush        KTM             a@a.c          NP           98545
  </code></pre>
  
  <p><em>2nd table is a temporary table and will hold single row only.</em></p>
  
  <p>Output required :</p>
  
  <pre><code>---------------------------------------
      Column_A                Val
  ---------------------------------------
      Test A                  Kush
      Test B                  KTM
      Test C                  98545
  </code></pre>
  
  <p>I tried pivoting 2nd table, but since its gonna be table with dynamic number of columns, it will be complicated.</p>
  
  <p>Is there any other alternative ?</p>