Which PHP driver are you using to connect to your SQL Server 2008 R2 instance? FreeTDS or the Microsoft driver?
Look at the output of PHPInfo(). If you're using FreeTDS it should contain a section called MSSQL. If you're using the Microsoft driver there will be a section called SQLSRV. If PHPInfo() doesn't show either of those drivers then your PHP hasn't been setup correctly for it to integrate with MS SQL Server. You'll need to fix that...
SQLSRV is probably the better option these days. You need to add the php_sqlsrv.dll file to your PHP \ext folder and then add the extension to your php.ini file, like;
[sqlsrv]
extension=php_sqlsrv.dll
The SQLSRV driver requires the Microsoft SQL Server 2008 R2 Native Client, so you'll need to install that too before PHP can load the SQLSRV driver.
See:
https://docs.moodle.org/34/en/Installing_MSSQL_for_PHP
https://www.microsoft.com/en-us/download/details.aspx?id=55642
Lastly, turn the Moodle Debugging option in http://yoursite/admin/settings.php?section=debugging up to Developer before you attempt the upgrade on your test server. Or do it in the Moodle config.php file, example:
$CFG->debug = 38911; // DEBUG_DEVELOPER
$CFG->debugdisplay = true;
That may help catching the problem with your Moodle and/or PHP setup.