Hey Graham!
In short, there's really no way to know if your melody was already created!
This is also the main reason there are many lawsuits regarding artists suing due to copyright & sounding similar.
All you can really do is just do your own thing as much as possible 👍
Apps like Shazam are very helpful to find the name of a song you don't know.. let's say you are out and hear the song, you can use Shazam to find the song's name.
However, I think how these apps work is by trying to match the song's frequency content to what's already in their database.. In other words, it takes into account the drums, melodies, vocals.. essentially EVERYTHING in that song, which makes its frequency footprint unique to any other song.
So using an app like this to see if a single instrument's melody is already taken will not work here.
What's even trickier is that music only has 12 notes.. so when it comes to chords & chord progressions, there will always be some type of overlap of your music to others..
It really comes down to wise sound selection of instruments and the musical rhythms of how you've placed your sounds which will make your stuff unique!
In short, just make music your own way!
Hope you've been well 🙂