How to create a file only with the header?

If no data from the sql execute ,then i want to create an empty csv file with column headers. The columns return from the database is not fixed.

You should make sure that the Write CSV header is checked and Ignore empty stream is unchecked.