title: How to export stored procedure data to Excel for dynamic columns in sql
body: <p>I have a stored procedure which returns values for dynamic column numbers. Suppose sometimes it returns value for 3 doctors so I have 3 columns, and the column name is doctor's name. </p>
  
  <p>Sometime it returns output for 5 doctors etc...</p>
  
  <p>I am done with my stored procedure but I want to export this data to Excel and I want to schedule this for a monthly basis.</p>
  
  <p>Anyone has any idea how I can do this? Can I use a SSIS package for this or can I use SSRS?</p>
  
  <p>Please let me know if you have any idea.</p>