How can I print the contents of a table to the console? My customer sends me complicated (and inconsistent) data. I am using C# and calling stored procedures in the database using the Entity Framework 6 to insert that data into the database. (The Entity Framework portion is only really handling data retrieval and ensuring a correct schema; inserts are done completely through stored procedures using table-valued parameter procedures.)

I use a series of Select DISTINCT statements to pull the unique entities out of the data and into temporary tables, then use those temporary tables to update the live database after verifying the data. (Credit to @srutzky for the idea.) 

I want to be able to print the contents of those temporary tables during the procedure so I can inspect it and/or write it to a log. The data they send is messy, and I want to make sure that my SELECT DISTINCT queries are working right. (Spoilers: they are, but the customer's data has more holes in it than decaying Swiss cheese.) 

The data can be inconsistent as well, so sometimes the same entity will have different types values on a field that it shouldn't, which will cause the DISTINCT query to select the same entity multiple times from the data and violate UNIQUE constraints in the table. I'm specifically trying to locate these "bad lines" of data both for logging purposes and to inform the customer that the data was wrong. 

This all has to be automated in C#. The program, when finished, will run on a remote server that I will not have write access to, so I also need the entire process to be "hands-off" (no sqlcmd, no SSDT, etc. Just T-SQL.) 

What is the best way to do this?
You should handle this all in the C# app code. Exporting data from T-SQL is not handled natively and requires SQLCLR, which is fine when needed, but it is not necessary here since you are already working within app code that can handle it quite cleanly.

You should have the app code do a SELECT (or grab the contents via EF if you say it can do that easily) and log it to a file after each step.

You should also have a command-line option/flag, or a check-box in the UI before clicking "Start", for "Debug mode" that will additionally display what is being written to disk along with an option to "Continue" or "Cancel".