To that end, most of the time I learn some idea on the drums I then apply it to a tune. In other words I sing the tune in my head while I play the lick, idea, or beat. There are many things you can gain from this approach.
1) You will play the idea for much longer if you have to get through a whole 32 bar tune while playing it. I often would play a new thing I learned twice or so before I moved on and would be lucky if I could play it again in the practice room 5 minutes later let alone on a gig in a musical context!
2) You will have to know the lick well enough to be able to play it without focusing on it exclusively.
3) When you apply everything you learn to song forms and melodies, you learn to be able to play anything you want when playing Jazz tunes without losing where you are in the piece. I really like being able to start things like metric modulations where ever I want without having to think in terms of numbers and Math. That has never worked for me! If I'm singing the tune to myself however, I feel very free!
Here's 3 examples of me playing various ideas while singing tunes out loud. The singing may be a bit hard to hear, but that's not necessarily a bad thing!
Here's the first one, I'm singing "Stomping at the Savoy" while playing a five beat lick where the sticking reverses between bass drum beats.
In the next one, I'm playing the exact same beat but apply it to a 3/4 (Someday my Prince will come) and a 4/4 tune (Savoy again). For those who are interested, the right hand is playing 8th notes, the left hand is playing 2 and 4, the bass drum is playing an on again/off again 5/8 pattern, and the hi-hat is playing on beats 2 and 3 in a bar of 3/4. Same beat, 2 different tunes in different time signatures, but it works because I'm hearing the tune and hopefully I can make the listener hear the tune too!
In the last example, I'm using the same beat but I put the right hand on the hi-hat and also sang "Stella by Starlight" for a change of pace.. What's also interesting about this one is I meant to put the click on 2 and 4 but put it on 1 and 3 instead. Also in the second example I made some "errors" with the bass drum part. But you know what? I didn't lose the melody or the form and that's actually the much greater "mistake" to make. When you're going for something in an improvised setting, only the person playing knows what they were going for anyway. As long as you can hear the tune, you'll be fine, no matter what happens.
Now, to start this don't get too ambitious at first. It takes awhile to develop this mental coordination. Try singing a blues while practicing doubles on the snare only, for example. Also make sure you REALLY know the tunes you're singing well.