None of these statements are valid SQL:
set nocount on
declare @MRN varchar(255)
set @MRN = 'xxxxxxxx'
Most likely, they are interpreted by whatever command line shell you use to connect to your database, and they most likely only set up output parameters and template variables that will get replaced in the real SQL later. That functionality does not live in the ODBC component of the database driver, or the database driver.
Either you shell out to the console and let it run the script, or you find out how to replicate the shell functionality with Perl.