Just ask (with an if statement) if your sprite will step outside the screen before making it move, and if it will, then don't move it.
This is, if X is not lower than screen left, if Y is not lower than screen top, if X + WIDTH is not greater than screen left + screen width - 1, and if Y + HEIGHT is not greater that screen top + screen height - 1
If you can be more specific maybe you can get more and better replies