Was your name in the text?
If not, then the sender probably does not know who is receiving the text, they are just sending out the texts to random telephone numbers hoping someone will return a call or text, so they can continue their scam. Forward the text to 7726 (SPAM).
Your telephone number is one of billions, anyone can call it, anyone can text it.
The only thing that can be private is the name associated with the telephone number.
When you reply to spam text messages they know they're reaching you and will keep trying. Your best defense other than blocking is to never reply.
Most spam text messages come from the internet, too. Whether you're aware of it or not, you're assigned an email address that will send SMS messages to your phone (like
[email protected]). Generally spammers will just guess your number by trial and error (which is why replying can be so bad, because then they know you exist). Many carriers will offer you the option of creating an alias and use that instead of your phone number (so it could be
[email protected] instead, for example). That can often do away with most of the spam you'll run into, unless you you start posting that email address all over the web.