Write Text File

Adapted from Rodrigo Acosta's script which exports to a text file the text of SPs. Parameters are the table/view name (may include a WHERE clause) , the output file path/name, and an optional list of fields (may include user-defined functions,cast/convert,etc..., the default is '*').