Either the object failed to instantiate, your code unset the object ($sql) in some manner, or the variable $sql is out of scope where it is currently being used. I'd put my money on the last one if I had to bet, but there's no way to tell with the current info.
If the line that is failing is within an object method, perhaps it just needs to be $this->sql->query(etc....), perhaps?
Anyway, if that doesn't get you pointed in the right direction, we'll probably need to see more of the code to understand the context within which this is happening.