This question is inspired by the recent news of Lashana Lynch taking over as 007.
Did the 007 position within MI6 begin with James Bond or did he take it over from a previous agent?
According to the wiki, Bond is the only 007 in Ian Fleming's Bond stories:
James Bond is the only agent 007. In the novel You Only Live Twice, Bond was transferred into another branch and given the number 7777, suggesting there was no active agent 007 in that time; he is later reinstated as 007 in the novel The Man with the Golden Gun.
But the Bond stories from Anthony Horowitz's novel, he takes it from another agent:
In Anthony Horowitz's continuation novel, set before the events of Casino Royale, an unnamed agent 007 is murdered, which leads to James Bond taking over the code-number in Forever and A Day, thus marking his first ever assignment as a 00-agent.
It's never explicitly said in the movies, but the first Eon Production Films 007 movie was Dr. No (1962) which is an adaptation of Ian Fleming's novel, so we can safely assume that the movies have the same backstory as the novels.
The spy designation 007 dates back to well before the time of Ian Fleming.
Queen Elizabeth I used spies, as did most people in power in those days, and one of these was a colourful character called John Dee who had the code name 007: vide http://www.woe.edu.pl/content/dr-john-dee-original-007
It is thought that Ian Fleming chose 007 for his spy from reading about John Dee.
Alec Trevelyan played agent 006 in Goldeneye, which clearly implies the numbers are sequential and incremental.
So its reasonable to assume that there are have been least 6 other double-0 agents and potentially more afterward.
Horowitz's book (Trigger Mortis) is not a Fleming book, but it "draws inspiration from unpublished notes" and therefore has less "authority" or credulence than Fleming's own words. However there are only 12 Fleming novels and 9 short stories published in the Canon from which to draw. (from https://en.wikipedia.org/wiki/List_of_James_Bond_novels_and_short_stories )