Halachically is ש a single letter with two pronunciations or are there 2 different letters in the Hebrew alphabet (shin and cin) which happen to be draw the same in the torah, have the same gematria etc. For example if the wrong letter is used in a legal document would the document validity be in question? Or if a scribe writing a torah intends to write a cin instead of a shin for God's name (sha-kai).
Torah, mezuzot and tefillin, or legal documents are written without nekudot (vowels). This includes the dot of the shin/sin. So there would be no halachic difference, being that there's no difference of the letter.
This is only for writing. When praying, reading the Torah, etc., you'll need to say it correctly.
Edit: I just realised that you wrote 'intends' for the Torah. I never heard of a sofer needing to know how the word is pronounced before writing it. As long as he writes it correctly, and his intention is l'shem mitzvah, I don't see why there should any problem.
I'm skipping the "halachically" part of the question, which others answered well, and just discussing whether they are two letters or one.
Yoma 75b "The word quail is written shlav, with the letter shin, but we read it as slav, with the letter samekh. What does this teach us?..." The gemara treats it as a kri/ksiv, as if the real letter is a shin, except - it is [always] pronounced as a S.
Similarly: Sanhedrin 70a “'And wine that gladdens the heart of man' (Psalms 104:15). The word for gladdens is written yeshamaḥ, meaning that wine makes one crazy, but we read it as yesamaḥ, gladdens the heart, meaning..."
And Sotah 3a: 'Reish Lakish says: A man commits a transgression only if a spirit of folly [shetut] enters him, as it is stated: “If any man’s wife goes aside [tisteh]” (Numbers 5:12). The word tisteh is written with the Hebrew letter shin...'
These examples make it sound like any sin is really a shin, only it is [always for that root] read differently.
Note that these are different from the more common ___ אל תקרי ___ אלא , "Don't read it ___, but as ___", where we are comparing an alternate reading with the standard reading (i.e., vowels).
Note also that for many piyutim that are in alphabetical order, the letter Sin appears in the place for Samech. (I do not think this ever happens in Tanach; see for example Psalm 119.)