Compile .sql script file using powershell

Looking for compilation of .sql script file using powershell code.

-> For example few .sql script files having wrong objects name or wrong columns names which are not located in the database or columns at tables. Then using powershell script I need to find out.

I think we can use one of the .dll file will check that compilation process.

Using the following keywords inside the tsql script will get the errors list without executing of tsql script.
-> SET FMTONLY ON: Getting meta data of objects not getting the rows of data.

->SET NOEXEC ON: It will only compile the data but not giving any errors list.

Is there any possibility to get the same behavior using powershell.
Please guide me how to accomplish this task.

Unfortunately, I have no idea whatsoever what you’re asking. You can certainly invoke T-SQL statements from within PowerShell, but as far as I’m aware it can’t “compile a .sql script.”