title: create a view which include exec
body: <p>I want to create the view of the following statement:</p>
  
  <pre><code>declare @tab1 varchar(20);
  
  declare @tab2 varchar(20);
  
  declare @tab3 varchar(20);
  
  select @tab1 = tablet from result where RANK = 1;
  
  select @tab2 = tablet from result where RANK = 2;
  
  select @tab3 = tablet from result where RANK = 3;
  
  
  exec('
  SELECT [1] AS '+@tab1+', [2] AS '+@tab2+', [3] AS '+@tab3+'
  FROM (SELECT RANK, time, row_number() OVER (partition BY koy
  ORDER BY time ASC) AS ranking
  FROM result) s 
  PIVOT (max(time) FOR rank IN ([1], [2], [3])) p');
  </code></pre>