Correctly support table aliases in SQL deploy check

Fixes #1102