To be clear, Invalid column name means the column doesn't exist in the result set.
The result set's returned columns aren't always fixed like the example I wrote above. The returned columns are dynamic due to they are left joined through some several tables.
What Kevin Chan and Warlin Garcia said about looping through the metadata's column name to check if the column exist in the result set maybe the only proper method so far.
It seems like this is a downside of Health Share studio as there isn't any solution to prevent this.
As stated by G Klein, studio becomes really annoying if it some how loses TCP/IP connection. The work-around I've used so far is increase the session timeout limit to high value (9999999), the issue still happens sometime, though.
Thank you for your anwser. Moving to REST now is not an option as the product is already deployed in live server.