How do you maintain long complex SQL scripts?

Database
Enthusiast

How do you maintain long complex SQL scripts?

We have quite a few processes that include 10+ files with 20+ scripts per file.  It is very complex trying to dig into where the problem might be when you have to dig through a bunch of text files.  Is there a better way of doing this?  My first thought would be storing the SQL in an actual database but then is there an easy way to execute that SQL?  I also found a program call SQL Tree that I may give a try. 

Thanks for the input!

Don