This may sound a bit simplistic, but would it not be simpler to check the sql server's availability by another method? For example if there's a shared folder on the sql server, you could check for visibility of that?