title: Get Table name from another query result
body: <p>I have a table as like below:</p>
  
  <pre><code>Table AuditLog(
  Reference varchar(10) [primary key],
  TableName varchar(10),
  ModifiedColumn varchar(10),
  ChangeData varchar(max),
  TableReference varchar(10)
  )
  </code></pre>
  
  <p>I am trying to achieve following query:</p>
  
  <pre><code>select *,
      (select accountNumber from [AuditLog.TableName] where Reference = AuditLog.TableReference ) 
      from AuditLog
  </code></pre>
  
  <p><code>AuditLog</code> table column '<code>TableName</code>' contain table name of that database. I need to load accountnumber from that table base on <code>TableReference</code>.</p>
  
  <p>I need to create a view with query. What is the right way to have table name populated dynamically?</p>