This procedure will print to the SSMS messages window a
formatted list of column names for tables, procedures, and
views that can be cut and pasted for creating other scripts
and procedures.
Options include adding brackets if that's your thing, pulling
actual sample data from the table/view specified, or you can
create your own custom query.
Format types are shown right below. At the very bottom I've
included examples of how to use the procedure. Below that I've
added scripts for creating a test table, test view, and a test
procedure. Run those once, then highlight all of the examples
(all at once if you want to) and you'll get the idea.
I'm sure I haven't covered every possible format someone
might want nor will some of the options do anything on every
format type. Also, performance was not really an issue here
since it seems plenty fast enough for something that is just
an ad hoc utility.
Please feel free to take this ball and run with
it. Just post to the forum any ideas or improvements so
everyone can benefit.
Regards
Steven Willis
19 January 2013