Although Sony's original Spider-Man trilogy was barred from using most Marvel characters outside of the wallcrawler's immediate acquaintances, J. Jonah Jameson was very much aware of the Sorcerer Supreme.
In a scene from Spider-Man 2, the man in charge of the Daily Bugle is looking for a catchy name for Octavius Spencer, the scientist who attached mechanical legs to himself in his rise to super-villainy. While running through names, a journalist suggests, "Doctor Strange!"
"That's pretty good," J. Jonah Jameson responds, before adding, "But it's taken!"
This has to make Marvel fans wonder whether or not Sony had some sort of plans to expanding their cinematic universe beyond the Spider-Man trilogy of films. Doctor Strange is a New York based hero in most accounts, manning the local Sanctum Sanctorum, so if he did exist by the trilogy's standards, an environment like the Daily Bugle's would be very much aware of his actions.
Still, there were no other mentions of the character elsewhere in the trio of films, indicating this reference was most like just that. At the time, cinematic universes hadn't been launched yet. Iron Man was still four years away from release and had not even begun production by this point. Director Sam Raimi probably just dropped the reference for giddy Marvel Comics fans in their movie theater seats.
It would be twelve years from this reference's theatrical release until Doctor Strange made a live-action appearance in the Marvel Cinematic Universe, ironically enough following Tom Holland's portrayal of Spider-Man which debuted in Captain America: Civil War. The two characters will finally crossover in Avengers: Infinity War next year.
Captain America: The Winter Soldier was the first Marvel Cinematic Universe film to acknowledge Strange's existence, as he would be mentioned by name in an interrogation sequence during the film's second act.