in SqlServer management studio, you can export query results to a csv file by right click -> "Save Results as" -> csv. However, the csv file does not contain column headers and does not escape any commas in the data itself, which often leads to a malformed file.
How can I export query results with headers and commas properly handled?