Parsing SQL without executing (SQL Server)

I’m working on some code which will generate SQL commands to be executed by SQL Server. In Management Studio, there’s a Parse command that will check the syntax of a query without executing it. Does anyone know of a way to do this kind of parse programmatically? I’d like to run a bunch of testing of the different SQL commands the code is generating, and I don’t need to have it take the time to actually generate the results at this point.

In ODBC, there is the SQLPrepare function that does some syntax checking with an extensive list of possible error codes. Offhand, I can’t remember how to cause an SQL compile in any more modern environment, since they’re mostly removed from the low-level accesses.