It isn't free, but
SQL Spec does a great job of that. You can download and run it without a license to see if it will do what you'd like, but it generates a watermark and nag lines in the output.
It is a great tool, and I use it a lot. The developer is a member here too, and is VERY responsive.
-PatP