Well the key determines your note pool basically...
You use the circle of fifths to determine that, so if you have an F sharp in your song and no other sharps you are most likely in the key of Gmajor or one of its modes (E minor, A Dorain, B phrygian, ext.....)
It's a little more complex than just that though...Usually the root note (in the key of C this would be C...in A minor this would be A, even though its the same note pool as the key of C..since this shift in tonal center is what makes a minor key and its relative major key different) is the strongest note in the song, the tonal center, and will begin and end the song. Of course there are also other considerations, key changes, modal music, blues....
Then it gets a little more complicated when say your jamming over a progression like Cmin | G7 | Cminor | G7 | because even though there is no A sharp chord your most likely playing in the key of A sharp and playing a ii | V | progression.
So to really answer your question you would have to post your song. I would also recommend you take a music theory course or a few lessons so that you can fully understand this stuff...its really not all that complex, and there are good reasons why everything works the way it does.