in reply to SQL quoting problem

Here is a random guess, based on the fact that I've never used SQLServer:

$dbh->do(qq{exec qp_MyStoredProg \@foo='} . $dbh->quote($bar) . "'");

Take that as untested and only offered because no one else has given a more definitive answer yet.