Short Answer: Yes, but...
Just make sure your call to
wp enqueue script is before the call to
get_header(). The problem is that when you're in a later part of your template the header including the script is already sent to the browser so you can't change it any more.
While this is possible I'd still encourage you to reconsider and put this in the
functions.php or a simple plugin. Enqueueing scripts is application logic and therefore shouldn't be in a template.