Depending upon your specific settings, Message Notifications and Previews may be accessible when your iPad is locked.
Whether or not your received Messages previews are visible, when your iPad is locked, is principally determined by your Message Notification settings. These can be configured in a variety of ways to meet the needs of the User.
The tags appended to your post suggest that you have a sixth generation iPad Pro - and as such will have FaceID…
When you review your Message Notification settings, you will note a main graphic (Alerts) - where you can enable locations where your notifications will be seen; these can be simply enabled or disabled as required.
Should you choose to so, you can deselect the Lock Screen - but also be aware of Notifications being configured to appear within the Notification Centre; dependent upon other settings, the Notification Centre can be summoned, from the lock screen, without first unlocking the iPad.
The screenshot shown here illustrates Notifications being enabled for the Lock Screen, Notification Centre and Banners…:
Settings > Notifications > Messages

Below the graphic, you will see the Lock Screen Appearance settings - where you can choose to allow previews to be seen when your iPad is unlocked, always, or Never:

As should be readily apparent, if you don’t wish your previews to be visible when you iPad is locked, you should not select Always - instead selecting When Locked or Never as best fits your requirement. Beware of the Default indication - as the default setting is itself configurable elsewhere in settings.
Armed with the information and knowledge that I have outlined, if you do not want your Message Notifications to be seen unless the iPad is unlocked, you should at the very least ensure that you have set Show Previews to When Locked, or Never.
Also be aware that the Customise Notifications section allows additional flexibility in refining Message Notifications - and if set, can override some other settings.
Notification Centre
Returning to the Notification Centre, you can choose to have messages appear in the Notification Centre - or not - by selecting this function from the Alerts graphic described above.
However, as already mentioned, the Notification Centre itself can be accessed from the Lock Screen while the iPad is locked. This behaviour is controlled from your FaceID & Passcode settings page:
Settings > FaceID & Passcode > [Allow Access When Locked]

The settings show above (bounded within the red box) show the most secure settings. When set as shown, the Notification Centre and other security critical functions cannot be accessed unless the iPad is unlocked.
When set as shown, if your Notification settings are configured to send your Messages to the Notification Centre, your Messages cannot be seen here unless your iPad has been unlocked.
For security, all of the bounded settings should be set to OFF - unless you have an explicit need for a specific associated function to be enabled.
Summary
If you wish to ensure that your Messages and Message Previews cannot be seen unless your iPad is unlocked by you, ensure that you have set the following settings:
Settings > Notifications > Messages > [Lock Screen Appearance] When Unlocked | Never
Settings > FaceID & Passcode > [Allow Access When Locked] - set all to OFF
I hope the above explanation and clarification is helpful to you - and fully resolves the security considerations and concerns that you have.