Where should I put a modified version of l() function? I want to customize l() function, which is part of Drupal 7 core and it is located in the common.inc file. 

Where should I put such a function? 

Modifying l() function or putting a new function in the common.inc would be considered hacking the core.
You should put it in your custom module. I think it's anyway good development practice to have a custom module in every project you develop.

What I do usually, is that I create MY_MODULE.helpers.inc file, and include it at the top of the .module file.

Here's an example of .module file:

// Get helper functions.
require_once dirname(__FILE__) . '/MY_MODULE.helpers.inc';


This way, if your module is enabled, the function will become available to other modules or your theme, and your .module file is cleaner because it doesn't include the helper functions.

You can see my Drupal 7 Boilerplate and specifically the boilerplate.helpers.inc file on Github.