Here is one I use quite regularly
;;; UB.LSP
;;; Copyright (C) 1997-2005 by K.E. Blackie
;;;
;;; kblackie -AT- resourcecad.com
;;;
;;; Permission to use, copy, modify, and distribute this software
;;; for any purpose and without fee is hereby granted, provided
;;; that the above copyright notice appears in all copies and that
;;; both that copyright notice and this permission notice appear in
;;; all supporting documentation.
;;;
;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
;;; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
;;; PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;;
;;;
;;;
;;; 15 March 1997
;;; 8 August 1998
;;; 29 November 2001
;;; 12 January 2005
;;;
;;;----------------------------------------------------------------------------
;;; DESCRIPTION
;;;----------------------------------------------------------------------------
;;; C:UB
;;;
;;; This function replaces a block reference specified by the user
;;; to another block already inserted in the drawing.
;;; All attributes are left in place and remain unmodified.
;;; No error checking is provided. It is presumed the user will
;;; know what blocks are already inserted and available for use.
;;;
;;;----------------------------------------------------------------------------
;;;----------------------------------------------------------------------------
(DEFUN C:UB( / as e index newname ss ssl)
(setq ss (ssget '((0 . "insert"))))
(setq newname (getstring t "\nReplace with block name: "))
(setq ssl(sslength ss))
(setq index 0)
(repeat ssl
(setq e (entget(ssname ss index)))
(setq as (assoc 2 e))
(setq e (subst (cons 2 newname) as e))
(entmod e)
(setq index (+ 1 index))
)
(PRINC)
)