Disable "helpful" iMac message icon when text with my iPhone
Yes, this can be done.

The best way to restrict access to your Messages is to use separate login accounts for each person using your iMac. Each account would then only have access to their own Messages.

If you would rather not set up accounts for everyone, you could simply turn off the alerts on your screen within the Notifications Preference Pane in System Preferences by turning the alert style to "None". However, this would not stop someone from simply opening up the Messages application to see all of your texts.