title: Dynamic Linked Server Query
body: <p>Is it possible to construct a dynamic query to for a linked server (and if so how)?  </p>
  
  <p>For example:</p>
  
  <pre><code>@linkedServer varchar(50)
  @var1 varchar(10)
  @var2 varchar(10)
  
  select * 
    from openquery(@linkedServer, 
                   'select c1,c2 
                      from t1 
                     where p1 = @var1 
                       and p2= @var2')
  </code></pre>