How to use iMessages without giving out phone number?

You can enable the iCloud email address under Settings → Messages → Send & Receive. After which just tell your students to compose a new message to your email address. They can even maintain your contact in their address books with only your email, not number.

Also, to prevent accidentally giving out your number, use email address to compose new messages. This setting can be found in the same place.