Sqlcmd

Use sqlcmd cli tool

mssql mssql-tools sqlcmd cli

Query sql server from powershell

mssql powershell sqlcmd cli