All you need to do is, if you're using the stock messaging app, is to go into settings>notifications. and under preview message, will be lock screen and status bar. uncheck lock screen and the content of the message won't be shown when your phone is locked.