Here's a method I use that works. First, sit down at your piano or keyboard and just improvise. I suggest improvising first because music that is created in this way is at its freshest. It's not adulterated or thought up. It is pure inspiration. Now, there will come times during improvisation where you may say to yourself, "this is nice and I'd like to develop it." You see, now you have an original melody to develop.
The trick is you don't need a lot of material to begin with. JUST TWO BARS IS ENOUGH to start you on your way. I usually work within 8-bar phrases so I know that the melody will usually end or repeat itself after 8-bars. I say usually because sometimes, the melody does not want to fit nice and neat into a predefined 8-bar phrase. But more times than not, the 8-bar phrase will serve you well