I have a .NET class (for discussion, ClassA) that calls a SQL Server stored procedure (for discussion, fooSproc), processing the results with a SqlDataReader. The rows are processed, and the columns are referenced using the name of the column in the returned result set. For example, where dr is the SqlDataReader, something like dr["column_foo"].
Now, say, for example, that a someone checks in a change to ClassA such that it is looking for column_bar in the result set returned by fooSproc. However, that person neglected to check in a change to fooSproc such that it would actually return column_bar.
The problem: the code compiles, but fails at runtime due to the missing column.
Is there a way to make this scenario cause a build error to be generated? Naturally a build verification/acceptance test makes sense here, but it's cheaper to catch it earlier. Please pretend that even a superficial code review is out of scope.