It had no name until Bilbo named it
It was not a sword, merely a dagger, and unlikely to have been used for much worthy of recognition. I can think of only one dagger in Tolkien lore that was worthy of a name - Angrist - it is not Angrist.
No-one remarks on it by name when it is found, or in any other situation, unlike Orchrist and Glamdring, swords that had great deeds attributed to them.
Bilbo named it Sting after killing the spiders in Mirkwood with it.
Spider #2: It stings! It stings!
[the spider then falls down to his death and Bilbo then looks at his sword]
Bilbo: Sting. That’s a good name. Sting.
The Hobbit: The Desolation of Smaug
In this picture from The Hobbit where Bilbo kills a spider you can see decorative swirls along the blade but no inscription.

However in this picture from The Fellowship of The Ring you can see that the decorative scrollwork has been redesigned with the Sindarin inscription Maegnas aen estar nin dagnir in yngyl im added between the swirls. This is translated in English to Sting is my name; I am the spider's bane

Here is a picture of the blade in the Hobbit alongside the blade in The Fellowship Of the Ring showing the lack of inscription in the Hobbit.

This would allow us to deduce that the inscription about being the spider's bane was added after Bilbo had killed the spiders and named it, probably in Rivendell, and wasn't something that was on the dagger when it was found.
This would indicate that the sword was not named Sting when Bilbo found it in the troll hoard.
Therefore Sting's name and story begins when Bilbo finds it.
Answer using the books
The dagger that was to become Sting was made in Gondolin by the Noldorian Elves of the First Age.
It is not mentioned in any of the books until it is found in the Troll hoard in The Hobbit.
Only one dagger is named in the Silmarillion, Angrist. This was a Dwarven dagger made in Nogrod whose story is arguably far greater than Sting's.
In the book Bilbo again named it Sting after killing the spiders in Mirkwood with it.
"I will give you a name, and I will call you Sting."
The Hobbit - Chapter 8 - Of Flies and Spiders
There is no mention of any inscription upon it in the books and is described as being quite plain when first found:
Two caught their eyes particularly, because of their beautiful scabbards and jewelled hilts. Gandalf [Glamdring] and Thorin [Orcrist] each took one of these; and Bilbo took a knife [Sting] in a leather sheath. It would have made only a tiny pocket-knife for a troll, but it was as good as a short sword for the hobbit.
The Hobbit - Chapter 2 - Roast Mutton
Gandalf does then go on to say:
'These look like good blades,' said the wizard, half drawing them
and looking at them curiously. 'They were not made by any troll, nor by
any smith among men in these parts and days; but when we can read the
runes on them, we shall know more about them.'
The Hobbit - Chapter 2 - Roast Mutton
It is unclear if he is talking just about the swords having runes upon them or the small knife as well.
But when they get to Rivendell:
Elrond knew all about runes of every kind. That day he looked at
the swords they had brought from the trolls' lair, and he said: 'These are
not troll-make. They are old swords, very old swords of the High Elves of
the West, my kin. They were made in Gondolin for the Goblin-wars. They
must have come from a dragon's hoard or goblin plunder, for dragons and
goblins destroyed that city many ages ago. This, Thorin, the runes name
Orcrist, the Goblin-cleaver in the ancient tongue of Gondolin; it was a
famous blade. This, Gandalf, was Glamdring, Foe-hammer that the king
of Gondolin once wore. Keep them well!'
The Hobbit - Chapter 3 - A Short Rest
As Gandalf only shows Elrond the two swords we can assume that Gandalf was only talking about the swords and that the blade that would become Sting did not have any runes upon it.
As the movies have the inscription in Sindarin we can conclude that this was engraved after Bilbo named it because:
- It references the killing of the spiders in Mirkwood - either that or the blade also killed spiders in Gondolin (of which no mention is made and would be quite a coincidence).
- The Noldorian Elves of Gondolin spoke Quenya not the Sindarin of the Grey Elves, they would therefore have engraved their blades in Quenya.