title: TSQL - export query to xls /xslx / csv
body: <p>I have a complicated dynamic query in TSQL that I want to export to Excel. 
  [The result table contains fields with text longer than 255 chars, if it matters]</p>
  
  <p>I know I can export result using the Management Studio menus but I want to do it automatically by code. Do you know how?</p>
  
  <p>Thanks in advance.</p>