If you want your iPhone only to receive notifications but not to display the message contents under locked state, here is the solution:
settings notifications messages turn off Show Preview
settings notifications messages turn off Show Preview