Instructions apply to devices withiOS 11and later.
Go toNotifications>Messages.
Under Alerts, tapLock Screento disable Message notifications on the lock screen.

The blue check mark icon changes to white to indicate it’s disabled.
you could also prevent texts from showing up as banner notifications in the Notification Center.
Exit the configs app.

ChooseNeverorOffto disable message previews.