The problem is that despite passing the intReturnValue by ref using the MakeByRefType() method (or at least attempting to if I have done it correctly), intReturnValue does not update. I have set it's initial value to -100 as this is never returned by the stored proc, but the test always fails - ie. intReturnValue never receives the stored proc return value.

Hello,
unfortunatelly I have no tools to test your code right now .. but I want share some thoughts about that.

I suppose that, that might be a problem with boxing of a ref-type variable when passing it in parameters list (by the way, have you tried passing it as "ref intReturnValue", rather than as "intReturnValue"). Anyways - take at look at this discussion: C# 4.0 ‘dynamic’ doesn’t set ref/out arguments.